package com.aiwhose.aiwhosecore.bean.security.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;

import java.io.Serial;

/**
 * 短信 表定义层。
 *
 * @author 田国刚
 * @since 1.0.1
 */
public class ShortMessageTableDef extends TableDef {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 短信
     */
    public static final ShortMessageTableDef SHORT_MESSAGE = new ShortMessageTableDef();

    
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 手机号
     */
    public final QueryColumn PHONE = new QueryColumn(this, "phone");

    /**
     * 内容
     */
    public final QueryColumn CONTENT = new QueryColumn(this, "content");

    /**
     * 服务商
     */
    public final QueryColumn SUPPLIER = new QueryColumn(this, "supplier");

    /**
     * 发送状态 0 成功 1 失败
     */
    public final QueryColumn SEND_STATE = new QueryColumn(this, "send_state");

    /**
     * 发送时间
     */
    public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");

    /**
     * 返回结果
     */
    public final QueryColumn RESULT_COMMENT = new QueryColumn(this, "result_comment");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, SUPPLIER, PHONE, CONTENT, RESULT_COMMENT, SEND_STATE, CREATE_TIME};

    public ShortMessageTableDef() {
        super("", "SHORT_MESSAGE");
    }

    private ShortMessageTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public ShortMessageTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new ShortMessageTableDef("", "SHORT_MESSAGE", alias));
    }

}
